//后端部分
const http = require('http');
const express = require('express')
let app = express()
let whiteList = ['http://localhost:9000'] // 可以访问源，白名单
app.use(function (req, res, next) {
  let origin = req.headers.origin
  if (whiteList.includes(origin)) {
    res.setHeader('Access-Control-Allow-Origin', origin)
    res.setHeader('Access-Control-Allow-Headers', 'name')
    res.setHeader('Access-Control-Allow-Credentials', true)
  }
  next()
})

app.get('/getData', function (req, res) {
  res.end('我是另一个域的数据哈哈哈哈')
})




app.listen(9090)


